package com.tangbao.news.service;

import com.tangbao.news.model.OneNews;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Component;

import javax.ws.rs.*;
import javax.ws.rs.core.Response;

/**
 * 功能: 获取新闻
 * 作者: zhouxin
 * 日期: 2018/3/2
 */
@Component
@Path("/news")
@Produces({ "application/json" })
public interface OneNewsService {

    /**
     * 分页获取全部新闻列表
     * @param currentPage 当前页
     * @param pageSize 页大小
     * @return
     */
    @GET
    @Path("/getnewslist")
    Response getOneNewsByAll(@QueryParam("currentPage") Integer currentPage, @QueryParam("pageSize") Integer pageSize);


    @GET
    @Path("/getOneNewsById")
    Response getOneNewsById(@QueryParam(value = "id")String id);

    /**
     * 新增一级菜单
     * @param oneNews
     * @return
     */
    Response saveOneNews(OneNews oneNews);

    /**
     * 编辑一级菜单
     * @param oneNews
     * @return
     */
    Response updateOneNews(OneNews oneNews);
    /**
     * 新闻点击次数+1
     * @param id
     * @return
     */
    @POST
    @Consumes(MediaType.APPLICATION_JSON_VALUE)
    @Path("/updateOneNewsClick")
    Response updateOneNewsClick(@QueryParam(value = "id")Integer id);

}
